package ee.subjects.frontend.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ModeFinder {
	private HttpServletRequest request;
	private HttpServletResponse response;
	
	public ModeFinder(HttpServletRequest request, HttpServletResponse response){
		this.request=request;
		this.response=response;
	} 
	
	public String find() throws ServletException, IOException{
		String mode = "undefined";
		try {
			if (request.getParameter("mode") != null){
				String requestMode = request.getParameter("mode");
				
				if (requestMode.equals("person")){
					mode = "person";
				}else if(requestMode.equals("enterprise")){
					mode = "enterprise";
				}else if(requestMode.equals("employee")){
					mode = "employee";
				}
			}
		} catch (Exception ex){
			//TODO Logimine
			//MyLogger.Log("MenuControllerFactory.service():",ex.getMessage());
		}
		return mode;
	}

}
